//
//  LeftTableViewCell.m
//  BeautyClother
//
//  Created by dllo on 15/9/8.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "LeftTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface LeftTableViewCell ()

@property (nonatomic, assign) CGFloat offWidth;
@property (nonatomic, assign) CGFloat offHeight;

@end

@implementation LeftTableViewCell

- (void)awakeFromNib {
    // Initialization code
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        self.offWidth = [[UIScreen mainScreen]bounds].size.width / 375;
        self.offHeight = [[UIScreen mainScreen]bounds].size.height / 667;
        
        
        self.bigView = [[UIImageView alloc]init];
        [self.contentView addSubview:_bigView];
        [_bigView release];
        [self create];
        
        
        self.title = [[UILabel alloc]init];
        [self.contentView addSubview:self.title];
        [self.title release];
        
        
        
        
        
    }
    return self;
}

- (void)create
{
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    
    self.bigView.frame = CGRectMake(0, 0, width, 300 * _offHeight);
    
    
    UIImageView *image1 = [[UIImageView alloc]initWithFrame:CGRectMake(100 * _offWidth, 0, width - 100 * _offWidth, 200 * _offHeight)];
    [self.bigView addSubview:image1];
    image1.tag = 100;
    [image1 release];
    
    
    UIImageView *image2 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100 *_offWidth, 100 * _offHeight)];
    image2.tag = 101;
    [self.bigView addSubview:image2];
    [image2 release];
    
    
    UIImageView *image3 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 100 * _offHeight, 100 *_offWidth, 100 * _offHeight)];
    image3.tag = 102;
    [self.bigView addSubview:image3];
    [image3 release];
    
    UIImageView *image4 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 200 * _offHeight, width / 3, 100 * _offHeight)];
    image4.tag = 103;
    [self.bigView addSubview:image4];
    [image4 release];
    
    UIImageView *image5 = [[UIImageView alloc]initWithFrame:CGRectMake(width / 3, 200 * _offHeight, width / 3, 100 * _offHeight)];
    image5.tag = 104;
    [self.bigView addSubview:image5];
    [image5 release];
    
    UIImageView *image6 = [[UIImageView alloc]initWithFrame:CGRectMake(width / 3 * 2, 200 * _offHeight, width / 3, 100 * _offHeight)];
    image6.tag = 105;
    [self.bigView addSubview:image6];
    [image6 release];
    
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    
    self.title.frame = CGRectMake(10 *_offWidth, 305 * _offHeight, self.contentView.frame.size.width - 20 *_offWidth, 40 * _offHeight);
    _title.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.1];
    self.title.numberOfLines = 3;
    self.title.textColor = [UIColor darkGrayColor];
    self.title.font = [UIFont systemFontOfSize:14];
    
    
    
    
}

- (void)sendPhoto:(NSArray *)array
{
//    UIImageView *first = (UIImageView *)[self.contentView viewWithTag:100];
//    UIImageView *second = (UIImageView *)[self.contentView viewWithTag:101];
//    UIImageView *third = (UIImageView *)[self.contentView viewWithTag:102];
//    UIImageView *four = (UIImageView *)[self.contentView viewWithTag:103];
//    UIImageView *five = (UIImageView *)[self.contentView viewWithTag:104];
//    UIImageView *six = (UIImageView *)[self.contentView viewWithTag:105];
    
    for (int i = 0; i < array.count; i++) {
        UIImageView *first = (UIImageView *)[self.contentView viewWithTag:100 + i];
        [first sd_setImageWithURL:[NSURL URLWithString:[[array objectAtIndex:i]objectForKey:@"url"]] placeholderImage:[UIImage imageNamed:@"zw.jpg"]];
    }
//    [first sd_setImageWithURL:[NSURL URLWithString:[[array objectAtIndex:0]objectForKey:@"url"]] placeholderImage:nil];
//    [second sd_setImageWithURL:[NSURL URLWithString:[[array objectAtIndex:1]objectForKey:@"url"]] placeholderImage:nil];
//    [third sd_setImageWithURL:[NSURL URLWithString:[[array objectAtIndex:2]objectForKey:@"url"]] placeholderImage:nil];
//    [four sd_setImageWithURL:[NSURL URLWithString:[[array objectAtIndex:3]objectForKey:@"url"]] placeholderImage:nil];
//    [five sd_setImageWithURL:[NSURL URLWithString:[[array objectAtIndex:4]objectForKey:@"url"]] placeholderImage:nil];
//    [six sd_setImageWithURL:[NSURL URLWithString:[[array objectAtIndex:5]objectForKey:@"url"]] placeholderImage:nil];
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
